﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SPIWareMVVM.ViewModels;
using System.Windows;

namespace SPIWareMVVM.Views.Commands
{
    public class ShowDeliveryListCommand : BaseCommand
    {
        public ShowDeliveryListCommand(BaseViewModel sender) : base(sender) { }
        public override void Execute(object parameter)
        {
            if (parameter.GetType() == typeof(DeliveryList))
            {
                DeliveryList list = (DeliveryList)parameter;
                if (list != null)
                {
                    list.lbDelivery.SelectedIndex = -1;

                    if (mainWindow == null) mainWindow = (Window1)Window.GetWindow((DeliveryList)list);
                    ApplicationData.SelectedCustomer = null;
                    mainWindow.HideLists();

                    mainWindow.deliveryList.Visibility = Visibility.Visible;
                }
            }
        }
    }   
}
